/*
 * @version: 1.2.3
 * @Date: 2022-11-24 17:13:11
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-12-02 13:57:39
 * @Description: 
 */
import 'package:flutter/material.dart';

class ThemColor {
  static Color primary = hexColor('#F04136');
  static Color background = hexColor('#F8F8F8');
  static Color fontColor = hexColor('#333333');
  static Color border = hexColor('#DEDEDE');
  static Color disabled = hexColor('#D5D5D5');
  static Color input = hexColor('#F2F2F2');

  static Color white = hexColor('#FFFFFF');
  static Color black = hexColor('#000000');
  static Color lightGrey = hexColor('#E1E6EC');
  static Color shallowDark = hexColor('#4C4C4C');
  static Color grey = hexColor('#E2E2E2');
  static Color grayish = hexColor('#C2C2C2');
  static Color darkGrey = hexColor('#999999');
  static Color red = hexColor('#FF4D4F');
  static Color boxShadow = hexColor('#000000', .02);
  static Color borderGrey = hexColor('#EBEBEB');
  static Color keyboardGrey = hexColor('#F7F7F7');
  static Color keyboardFont = hexColor('#666666');
  static Color borderSet = hexColor('#E5E5E5');
  static Color borderBth = hexColor('#DADADA');
}

Color hexColor(String hexColor, [double alpha = 1]) {
  hexColor = hexColor.toUpperCase().replaceAll('#', '');
  if (alpha < 0) {
    alpha = 0;
  } else if (alpha > 1) {
    alpha = 1;
  }
  if (hexColor.length == 6) {
    hexColor = '0xff' + hexColor;
  }
  // 先分别获取色值的RGB通道
  Color color = Color(int.parse(hexColor));
  int red = color.red;
  int green = color.green;
  int blue = color.blue;
  // 通过fromRGBO返回带透明度和RGB值的颜色
  return Color.fromRGBO(red, green, blue, alpha);
}
